package com.itheima;

public class ThreadLocalText {

    private static final ThreadLocal<String> threadLocal = new ThreadLocal<>();

    public static void main(String[] args) {
        threadLocal.set("aaa");

        new Thread(new Runnable() {
            @Override
            public void run() {
                threadLocal.set("bbb");
                System.out.println(Thread.currentThread().getName() + " : " +threadLocal.get());
            }
        }).start();

        System.out.println(Thread.currentThread().getName() + " : " +threadLocal.get());
        threadLocal.remove();
        System.out.println(Thread.currentThread().getName() + " : " +threadLocal.get());
    }
}
